home *** CD-ROM | disk | FTP | other *** search
- Path: nova.umuc.edu!not-for-mail
- From: srussell@nova.umuc.edu (Steve Russell)
- Newsgroups: comp.lang.c++
- Subject: More Class
- Date: 4 Mar 1996 00:47:56 -0500
- Organization: University of Maryland University College
- Message-ID: <4he06c$qhp@nova.umuc.edu>
-
- I'm doing my first c++ program on unix, my first c++ programs
- with classes, and my first c++ program linking all the seperate
- components ( main program, class header, member function file)
- together.
-
- I would like to ask some preventative questions before I compile
- as I did most of this without text support:
-
-
- The first is if you use the function "strcmp" do you have to
- actually rename your strings 's1' and 's2' and can you put
- just any two strings in the function call?
-
- Also, using emacs, c++, g++, do I compile the class, the member
- function file, and the main program seperatley or will emacs
- do it all at once if compile the main function?
-
- Also, this is my first time doing classes, doing them in seperate
- files, and linking them. I'm also doing it without any examples.
- I wrote down the preamble to each three components below. Could
- you see if I suffixed the files appropiatley for unix & c++?
- Also could you see if I "#included" everything I should to make
- sure it all links okay? Also, I dont really know what the purpose
- of "endif" is, did I use enough of them?
-
- Thanks I owe you a big one
-
- Steve
- srussell@nova.umuc.edu
-
-
-
- 1. class header file name( contains decalrations and member prototypes):
- EmpRecords.h
-
- //FILE: EmpRecords.h
- // STORES AND MANIPULATES FILES OF EMPLOYEE RECORDS
-
- #ifndef EMPLOYEERECORDS_H_
- #define EMPLOYEERECORDS_H_
-
- #include <EmpRecords.cc>
- #include <fstream.h>
- #include <iomanip.h>
- #include <iostream.h>
- #include <stdlib.h>
-
- ( the class, declarations and prototypes )
-
- #endif
-
-
- 2. file for the class member functions: EmpRecords.cc:
-
- //FILE: EmpRecords.cc
- //MEMBER FUNCTIONS FOR CLASS EMPLOYEE_RECORDS.H
-
- #ifndef EMPLOYEERECORDS_CC_
- #define EMPLOYEERECORDS_CC_
-
- #include <EmpRecords.h>
- #include <fstream.h>
- #include <iomanip.h>
- #include <iostream.h>
- #include <stdlib.h>
-
- ( member function definitions )
-
- #endif
-
- 3. main program that uses class employee_records: project2
-
- // FILE: 240_2.C
- // MAINIPULATES EMPLOYEE RECORDS VIA A CLASS
-
-
- #include <EmpRecords.h>
- #include <fstream.h>
- #include <iomanip.h>
- #include <iostream.h>
- #include <stdlib.h>
-
-
-
-
-
-
-